refactors big switch statement in main.js
General refactor -> preparation to merge pr #10
Merge remote-tracking branch 'stoeffel/big-switch'