Cleaned tentacle ai code, unified counter for states