Replace strlen() with empty()
Implement restoring state