moved map drawing logic out of main