use ucfirst() and implement safe substitution