Refactored UI to seperate package and added thread to main class