Added code to iterate through views automatically (closes #716)