refactored more code to draw_event.js