Rewrite keypad

Change-Id: I7094cda3775c711839d0a7e0f293c304ee37358f