updated error/success handling