Added mem_size to template