improved parallel code organization, improved temp organization
fixed typo