First step of some refactoring

This is the first step of my refactoring of the init script.