complete thumbnail function and unit test