fix recursive method in PP, refactor tests