Added for loops and if else