#716 polished, all tests pass