implement recursive resources and links plus minor clean up