Implementing example of simple reference counting.