Add helper function to the codebook tool