started rewrite of piece handling