CLOUDIFY-1751 more refactoring/cleanup/fixes