Added more rigorous tests which had broken my own code