New generic function to serve resource data
Fixed couple thing in generic resource-serving function