Added a if/then, even if isn't not necessary.
The syntax is cleaner and we test the variable before the use.