adding optimization for faster mapping