Refactorings to better suit new generic SGE structure.