Finished a preliminary reduction implementation