Refactored result for alg