added sort method for map