Use map instead of each in extract_sources()