custom algorithm fixed