added function close distance