Fix JSHint error: Don't create functions in loops
Add in temporary thumbnail of image for debugging