first version
finish reducer part