libscp: refactoring