Added more options parsing and a new event-emitter-based mechanism for tracking job states