yet another speed calculation optimization