[refactor] Reorganized much of the core resource logic into separate modules.