refactoring
started moving modes / switch modes code to modes.js
modes.js refactoring
modes.js refactoring
finished refactoring modes logic into modes.js
more modes.js refactoring
housekeeping