mem leak fixes and rename implementation++++++