Added memory tracking