more work on the resource api
naive, improved safename function
mongo testing