M1 implementation

Merge M1 to master