Further refactoring of map drawing