Updating the main function to do a proper return and added some testing to the bottom to run it in non GUI mode to do some testing. shell for the dat report dialog too.