Fundamentals of Titanium Interactions with Nitrogen and Oxygen