refactor which data element to use to function