Removed RefCounter and replaced it with smart pointers