Moved finddist function into atomic library.