rewriting functions.js as maps.js