Added check for vine sorting