Refactored code

Support for multistate resources: clone and master. Correct renaming and deleting of them.