changed logic of logs and state changing, closed #10