Abstracted UI code from main class.