this function is getting pretty messy, but I'm not sure if there's a good way to handle multiple key inputs.