Added Peterson algorithm