Pointer Optimization, Some Sorting Code

Sorting code may or may not be working.