BUGFIX: use functools.reduce for python3 compatibility
BUGFIX: call list on map output for python3 compatibility
BUGFIX: call list on map,filter output for python3 compat
BUGFIX: wrap all 'map's with 'list()'