Moved application code to its own .js file