Moved distance as a method + added some debugging