An implementation of event based control flow