Implemented loops and scope returning