Refactored the ResourceManager a bit and added an utility class for doing
deep copies.