trying to optimize int dist