added logging and proper emailing and other things
some changes to file parsing