Clean up entity capture code.