Refactoring key strokes.
(Still in progress. But all the test cases are passed so far)