Refactor to extract source analysis to an external command