Additional work on #185, mostly cosmetic refactorings

- move statistics functions out of SeriesModule
- remove statLevel
- combine applyLevel, flatten
- add applyLevelOptional
- add flatMapValues to Series