Add cleanup functions to the settings API