free memory scheme added