Merge "Refactor thumbnail layer code"