Refactored code, TkInter added