Faster version (like 2d and 1d)