Refactoring gis.js