list/target refactor

This follows up #2532 and #2392 abstracting out some duplicated
code.  Still not perfect, but better.
Merge pull request #2874 from rolandwalker/target_refactor

list/target refactor