Added memory to generic template