Started refactoring so that it peer can handle multiple pieces at the same time.