Added isOpen field and created enhanced for loop