Implements aggregate and reduce (janky done stuff)