Wrote this awhile ago, just commiting so it's in git and I can grab it from my new computer. Will finish this later.