modified correctAngle() to add PI loop
added commonFunctions files and added clamp function
moved threshold() to commonFunctions