Refactor the PxLoader file