Mixed up tuple order - now algo works