Implemented my own version of counting sort