changed AutoResetEvent to ManualResetEvent since it was being manually reset anyway
merging in changes from master