Copy over code from PIC version.