Replaced hd(explode(..)) with String.sub(..,0) in checkMapping.

For readability, String.sub is easier to understand and possibly faster
then hd(explode(..)).