SelectMany improvements and new tests