refactor out some responsibilities