More refactoring of startup.js