Refactored events stuff

I needed to do this to internally manage firebase events, and prevent multiple firebase events from being triggered at once.