main.scala.js refactoring