cleaned up code, reinstated mouse functionality