Refactor map javascript, add setMarker function