Refactor storedApiSettings handling