Working sample, with some tests.