Clean up settings code a lot