offer code updated

Included new error handling.