Make a setup function and some cleanups
Make setup functions external for easier tweaking, fix progress indicator