Reorganize checking and extraction of spaces and sources