Added listener wrappers and some structural changes.