modified the max recursion depth to use clamp logic
small bug