add notifications support, refactor