modified so that map changing is supported