Replaced remaining RefCounter classes with smart pointers and replace it