got rid of pair: now much faster