Fix undefined vars

-Updated the gitignore file
-Fixed code to check if the variables are set in the challenges to avoid 'undefined variable' error