Stats screen works with history items.

Refactoring of communication and persistence.
New UI for stats screen.