added next piece functionality