Fix the way events are broadcasted, moved unit tests around.