cleans up some code. particularly records and List.fold_lefts