added a clamp to the mapVals function