Basically working, just some cleanup to do.
A bunch more cleanup.