Added loops and structure