Changed code to allow pieces to move. The code should probably be
cleaned up and placed inside a helper function, but the bare essentials
are there.