speed improvement for get_sources