Adding additional testing of whether variables exist