this is new logic and needs a test - otherwise it will surely break the next time I do a refactoring.