Add shellsort; slight refactoring