Separated client and server side JavaScript to make the code testable. Not really happy so far.
Added Sinon and drafted some tests