works much faster now with map