Arduino Mega 2560 - Keypad 4X4

Does your code look any similar to my example? I have only if statements that go inside the main loop(). So the ifs are reached in every round the program makes. In your version the while loop is never left because the keypad is never checked.