Added save to file and email as attachment code. Need to debug