Mock ecloud and add bugfixes and improvements.

Fixed 1.8 compatibility from last request and squashed commits.