added support for before listeners