Make code more robust

* Add the words uppercased
* define some variables with var
* check null values