Smooth validation function