changed if statmenents to allow dynamic to properly use OMP