Add error handling; exit with error code 1 if something goes wary.