basic map reduce functionality...buggy