Added keyboard support.

Added method for setting custom key mapping.
Complete rewrite.