Rewrite of the Scala Backend in js