Added loop functionality.
Added in some distance functionality