Js refactor

Pulls the business logic out of the controller and into a utility class

what exactly are you after? Is the new javadoc enough? It seems reasonably self documenting.