Statistics and bug-fixes

Bugfixing, functionality and statistics.