Changed listify to return original array if num_elements < max_element