SPDII40-refactoring code