Refactor record init/deinit