removed all the if statements, wrapping using %. Wrapping complete for theta