refactor thumbnail setting and begin writing tests for it