add a test for second part of the algorithm'