Global refactoring of map js