add a summary report; generalized some functions for re-use.