Moved mouse-handling to a separate function, pre-rendered X and O characters, added event.wait to event handler