some of the loop kernel code done