updated emailing. cleaned up unused code.