Adding LM code