adds config and cleans up