Refactor the get_possible_moves and offset_and_check_avaliability methods to be shorter and more readable by splitting it into smaller chunks