Use utility function
remove some debug lines
refine bucket balance function to ensure we always assign each bucket min(redundancy, peers) nodes