BEGIN REFACTOR OF DEADLY MAP.JS