Moved application code into its own class.