Apparently working gcm and lcm methods