completes main body of seam removal functions