added entryExists, added delete[] call