added state() method and more renaming.