Fix unwanted filter() and map() side effects.  Minor cleanup.