Change to some nice error handling code