Added legality checker. Small changes under board utils.