squared distance (maybe change the function name too)