rewrite validate code module