added proximity formula