modularize maps JS into functions