tweaked distance calc