adding values to codes function and adding coding to plot