refactor compiling spaces