Added keyboard event callback functionality.