DMP algroithm, part 1