debugging with small examples, seems correct