Refactored map logic and graphics into two files