First Try of 4 algorithm