Keep your code modularized and specific.
It is attractive and informal to write one function that does the whole thing. However, as you spread the functionality you will find that you do the same things in numerous functions.
To avoid that, make sure to write minor, general helper functions that achieve one precise task rather than catch-all methods.
At a later phase you can also depiction these functions when spending the revealing element pattern to generate an API to spread the main functionality.
Decent code should be easy to shape upon without reworking the core.