added cluster management
refactored out unused code