Various modifications to get unit tests working again. Attempting to get the 'end' event to fire and it just won't.