Added automatic settings save and restore functionality