Simplify avalon scanhash code using the new find_queued_work_bymidstate function. Partially works only.