Added clampf instead of if statements