Added getState, renamed getChildren to getNames, and improved error
messages.

Change-Id: I6ab90aa52236be0fd16306ea6afca06281eae071