Removed dead code, added optional reduce function to callbackGenerator and changed its name