Rls algorithm