merge setValue and getValue into one function