moved map script into separate file and set stage for layer switching based on violating condition