added hacked together loop offset support