Added logging with winston; removed unused (and problematic) 'each' function