Removed the misleading comments.
Introduced unit tests for global_state. However not full coverage yet.
Added forgoten INDEXes to the sql implementation.