refactor again with extra conditional  to satisfy all tests