Added for loops and if statement