piece and side statistics rewritten, notable speed-up