added piece creation logic