Move error handling up.