TODO add more comments, david read code and try to see if it can be improved, specifically the actionevent thing to check if the timer has ticked and stuff