Atomic structures and electronic properties of 2H-NbSe2: The impact of Ti doping