Lots of changes. Should really commit each of these separately...