-- fixing code and tests for more generic retrieve