updated for lcm and gcf