moved functions to fxa.js and parameterized vars