unified reporting functionality and moved into lib