more effictive version.