Add comments to state API state() function