Lots of changes.

Have a look through the list of commits to see the changes.