move history widget code to separate file