factorize more skip_code stuff