Added 'filterMap'

* new method filterMap which acts like map, but only if the test succeeds
* rewrite of map to use filterMap
* rewrite of filter to use filterMap
Using "mapReduce" in "reduce" to remove code duplication