Update tests.
Refactor thumbnail code.