As it didn't belong in an existing file, this has been moved. The tests and the code are currently unfinished, further testing required.