Added generic function to compose M3s