Building your own reduce array method