Realised that the solution was not catering for out of order dependencies.