Move actual searching for direct targets to a generic function

This will allow it to be more easily used for enrichment analysis