Modified Loops in class