moved all map code into own class