Application logic move

Moved the application logic out of the UI specific code so that the main
application code is now 100% free from any UI package.