Feature/deploy cleanup

Moving things into functions and giving `main()` more control