Cleaning up getValue method.