CLOUDIFY-2531 initial refactoring/code cleanup