add piece-id function