Made ApplyLMS function