Cleanup

As discussed here's the first cleanup branch.