Persistent UIState

changed UIState from pointer to location, index, type and content type
Style fix and changes for persistence

Styles fixed hopefully everywhere...