Made some improvements and error catching