working on main.js
halfway trough startup logic refactoring