Add schemas code, second attempt.

I agree that smaller doesn't always mean cleaner. Not sure about using if statements to protect unsafe operations though when there are what I would consider better and more readable alternatives instead.