Think Ive fixed the issue, keeping debug code in case.