attach map layers to window, move functions to appropriate files