A bunch of general improvements