optimize by destroying unused array