refactoring SLD code