Adding state module and logging