REFACTOR: drawing functions
refactor isItemOnPath function
refactor events