add worker + fix function using 'reduce'