Simplified some code. Added piece serialization.
Debug message