Some code refactoring.
Add a cluster library