Fix bugs, refactor and support left and right key.