Added for loop and conditionals