Modified the memory gauging part of the code and did documentation.