added Portfolio; refactored Stock; added flatmap test