Added better comments and parameterized the conditional execution of the SGE hack and swap.