Added save state
Fixed sorting logic error
Added persisted settings
Fixed state reset