Seems ok now, a few more tests to do...