to simplify the code, made peerPieceTotals a temporary structure in controller along with a few other minor changes.