Fixed the implementation for selecting and moving pieces in the UI