Added a little to the isLegal method.