new version that runs on 1/3 the speed of the old implementation