Moved some code in main controller into smaller functions.  Added npix stats.