Refactor key mapping

@Akon32, @rexim, someone, please review this.