Made the map global, repaint does not work without it. I think something to do with recur and how it binds the map is involved. need to check