Added error handling.
Updated gitignore.