Added event support, and eased th euse of hooks.