Use ES6 Map if available, be API compatible

- Update tests as well