I think the code would be much more readable if instead of using map/partition calls, you would use a for statement  with and if in it and just add options to a final list.