added safeguards for the possible angle values passed to the arm.