Refactored code to include a board class, which handles mapping locations to pieces and checking that a move between two locations is valid.