Add VERSION to the Marionette application.

Also refactors server-side code to be a bit cleaner. Resolves #277.