Changed the array so that it deallocates memmory on erase.