Started working on algorithm M