added sort method and removed map