Added some error handling and fixed typos