refactored for cloudhub