exception handling

added clamps to account for edge cases found in testing