Tidy up settings handling