changed "flag" to more descriptive "shutdown"