One of these days I'll break that code into smaller chunks and separate functions so it's easier on the eyes.