Added in example cluster code and refactored code