refactored Resource module (separate logic)