move codes to new file to seperate UI/logic