Refactor map_creator.js