Event bus, beforeWrap event and bug fixes
Added afterWrap event.