rewrote map.js, need to add real tests