added sail functions and added sail to main loop