factor out map js to script file