Resolving issue about duplicated code and wrong logic for pieces movement. More updates to come.