further tidy up in retr / stor using RAII for resource handling