change braces position

put opening braces in the same line.
modifiy fuction getDistance

add "else" case, combine same return.
modify format

put one parameter per line.