Matej's shiny new test with (hopefully working) source code. This one sure is looooooooooooooooooooong.