improved thumbnail creation method