Updated loop and button action