Refactor value retrieval and storing to return only one value.