PAL: Refactor the processing of spec and download