Addressed a few comments. Specifically, I removed an unused variable and I changed line 80 to always exit on errors