Add reduce action generator + Refactor + add comments