adding intermediate codes