Add schemas code, second attempt.

I'm struggling to understand an algorithm that I've only just invented. I don't need to add more Scala syntax yet. I want to write it the easy way before writing it the clever way.