changed C to diagonal matrices