First commit. Mostly complete

Still a few things to do.