Separated the logic from GUI