Added parseSort function