Updated language detector code