changed the loopin structure.  Version 3