Moved core application code into own class