Refactoring, redesign of trainer to prevent duplicate problems; sortable statistics

Sortable statistics implemented. Trainer redesigned so that duplicate
problems do not appear during a single problem-solving session. There's
a bug in the stats table at the moment because $index doesn't sort
nicely like the rest.