Added connection error and fixed infinite recursion.
Fixed gitignore.