added support for saving the configuration in preferences