Add totalPieces function
Add storage streaming
Check size of last piece properly (in writePiece)