Refactor of app initialisation