Added a check to the greeting function