Moved distance variables in controller inside of do_distance if statement