remove unnnecessary event detection
move utility functions to another file
events fix; delete duplicates in array