add then guess code function framwork