issue #3945: Refactor basic data structures