Working basic sort