def namelist(names):
    """
    Function which returns a new list with proper formatting between names.
    :param names: an array containing hashes of names
    :return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.
    """
    list = [name['name'] for name in names]
    if len(list) <= 1:
        return ''.join(list)
    else:
        last_two = ' & '.join(list[-2:])
        first = [n + ',' for n in list[:-2]]
        first.append(last_two)
        return ' '.join(first)