Add encapsulated keyhandler infrastructure