Resize map to fit window
Impoved query function