function initialUpper(item) {
    var pattern = /(\w)([\w\-\'\.]*)/; // a letter, and then one, none or more letters 

    var a = item.split(/\s+/g); // split the sentence into an array of words

    for (i = 0 ; i < a.length ; i ++ ) {
        var parts = a[i].match(pattern); // just a temp variable to store the fragments in.

        var firstLetter = parts[1].toUpperCase();
        var restOfWord = parts[2].toLowerCase();

        a[i] = firstLetter + restOfWord; // re-assign it back to the array and move on
    }
    
    return a.join(' '); // join it back together
}
