Some refactors in resource manager; first glimpses at resources management