Added use of Source class

The framework now uses a Source class to determine how many
events should be processed.
Created a CountEventsSource to replace the old way of looping over
a set number of events.