Move save config function to module