Refactored getEvents function into utilities file