Rewritten state system, added logs