Adding some checks and clamps...