updated loop.c