JCLOUDS-664 Removed dead code and refactored good code.