Added ref iteration support
Proper freeing of refdb backend