Cleaned up parallel code. Removed global variable.