final version for submission. Still some bugs to fix: such as download of report is possible only once. Need to find out why?