combine keys into a struct
handle key events in separate function
organised variables into structs, moved code out of main loop into functions