Moved the if condition higher in the program
Always a good idea to include an initial value
Placed the main points in the try block
Merge pull request #1 from jsoto008/patch-1

Moved the if condition higher in the program