Added realisation of my algorithm for P3