Remove unused variable, add 'die', shorten error checks