SPH-code refactoring.