moved mouse event functions into new object and cleaned up event functions