added functionality for events loop, need to go over others though