Added saving of preferences to registry