Refactored algorithm validation