started refactoring stuff that listens for events