This function it too long to live in the header.