Update init script

Aimed at fixing #350, but I may not be completely across what's needed. Submitting this PR anyway and can fix anything else that comes up.