Rewrite of the Scala Backend in javascript