refactoring: moved almost all JS from view to App object