updated to work with values rather than name