Template Code:

if/elif/else to remember flags: