add statistics
optimized dependencies for viewer
added more grouping criteria
cleaned up a little, tweaked algorithms