Changed to listener-based input handling.