Added thread.sleep() to hopefully keep it from prematurely exiting.