minor changes to comments and handle_error function