major modify on memory usage