Tidy up now that Put works (apart from leaking memory).