added keyboard and mouse event handlers