implemented reference counters