Fixed some Cloud API bugs, added tests for Cloud API and Cloud Environment components.