Refactor private share, and fixed a few bugs