Moved map creation into separate function.