Adding a writeconfigfile function