rework to use array of hashes for event callbacks