Performance increase in thumbnail handling

Change-Id: I1a9cd2f1dafc3f1b192d5f4210612df771fbfb04