Changed the logic to test which piece moved.