for speed-up, using map instead reccursive