changed to handle 4 keys for input