LMS

added Gabe's code