resolving looping issue