made map external and more general