resource controller refactored