CLOUDIFY-1812 made some refactoring