removed mail part. leaving js code for reference