refactor: move dom helper to separate js
improve: add tests, improve mvc