made map.js external and more general