Make error messages more consistent
Make state_change initialization more conventional
Missing semicolon
Make a copy of the input list so that changes to the children list don't automagically change our reference list