major refactoring
some reporting improvements