This will actually work, optimising comes later.