lcm helper function added