First really working commit. Still a lot of work to do, but it's a good base.