Here's some code that's kind of functional.