applying distance