Implemented isLegal