required func code