public static String improvedCountSort(String str)
    {
    	final int alphabetLength = 26;
    	final int alphabetAsciiStart = 97;
    	final int alphabetAsciiEnd = 122;    	

        int[] alphaCount = new int[alphabetLength];
        StringBuilder sb = new StringBuilder();
        
        //count occurences of alphabet letter
        for(int i = 0; i < str.length(); i++) {
        	int val = (int) str.charAt(i);

       		// Is letter
        	if (val >= alphabetAsciiStart && val <= alphabetAsciiEnd) {
        		alphaCount[val - alphabetAsciiStart]++;
        	}       	

        }            
        
        for(int i = 0; i < alphabetLength; i++)
        {       
        	char c =  (char) (i + alphabetAsciiStart);
        	
        	for (int j = 0; j < alphaCount[i]; j++) {
        		sb.append(c);
        	}
        }

        return sb.toString();
    }