refactored get_resource