Clean-up code
+Łukasz Balamut: fix for recent versions of Chrome

We have no idea why, but Array.reduce seems to be returning the original
array instead of behaving properly.