Reorganized Sort class and added comments