fixed sorting, added html to report generation