Added die function for better error handling/reporting