added email field -- unified js code