improve map javascript