attempt at getting notifications working. refactored code to be better encapsulated.