Lots of changes

Look through the commits to see all the changes.