Implemented most of the settings API.