Added generics to events.
Fixed dependency ordering.