refactor a bit; fix an issue with a test failing
tiny tweak