created sortRows method