Moved image grabbing into thread