Started adding error handling