Done all but building isLegal functions