Most of resource manager implementation.