refactored location marker code, made improvements to event handling and drawing function