Index: kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h
===================================================================
--- kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h	(revision 619)
+++ kernel/include/IMP/singleton_scores/DistanceToSingletonScore.h	(working copy)
@@ -10,7 +10,7 @@
 
 #include "../SingletonScore.h"
 #include "../Vector3D.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../UnaryFunction.h"
 
 namespace IMP
@@ -21,7 +21,7 @@
  */
 class IMPDLLEXPORT DistanceToSingletonScore : public SingletonScore
 {
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
   Vector3D pt_;
 public:
   DistanceToSingletonScore(UnaryFunction *f, const Vector3D& pt);
Index: kernel/include/IMP/singleton_scores/AttributeSingletonScore.h
===================================================================
--- kernel/include/IMP/singleton_scores/AttributeSingletonScore.h	(revision 619)
+++ kernel/include/IMP/singleton_scores/AttributeSingletonScore.h	(working copy)
@@ -9,7 +9,7 @@
 #define __IMP_ATTRIBUTE_SINGLETON_SCORE_H
 
 #include "../SingletonScore.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../UnaryFunction.h"
 
 namespace IMP
@@ -20,7 +20,7 @@
  */
 class IMPDLLEXPORT AttributeSingletonScore : public SingletonScore
 {
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
   FloatKey k_;
 public:
   AttributeSingletonScore(UnaryFunction *f, FloatKey k);
Index: kernel/include/IMP/SingletonScore.h
===================================================================
--- kernel/include/IMP/SingletonScore.h	(revision 619)
+++ kernel/include/IMP/SingletonScore.h	(working copy)
@@ -9,7 +9,7 @@
 
 #include "IMP_config.h"
 #include "base_types.h"
-#include "internal/RefCountedObject.h"
+#include "RefCountedObject.h"
 #include "DerivativeAccumulator.h"
 
 namespace IMP
@@ -27,7 +27,7 @@
 /** SingletonScores should take a UnaryFunction as their first
     argument if such is needed.
 */
-class IMPDLLEXPORT SingletonScore : public internal::RefCountedObject
+class IMPDLLEXPORT SingletonScore : public RefCountedObject
 {
 public:
   SingletonScore() {}
Index: kernel/include/IMP/Model.h
===================================================================
--- kernel/include/IMP/Model.h	(revision 619)
+++ kernel/include/IMP/Model.h	(working copy)
@@ -10,7 +10,7 @@
 #define __IMP_MODEL_H
 
 #include "IMP_config.h"
-#include "internal/Object.h"
+#include "Object.h"
 #include "internal/kernel_version_info.h"
 #include "base_types.h"
 #include "VersionInfo.h"
@@ -30,7 +30,7 @@
     Currently no suport for constraints (e.g. rigid bodies).
     \ingroup kernel
  */
-class IMPDLLEXPORT Model: public internal::Object
+class IMPDLLEXPORT Model: public Object
 {
   friend class Restraint;
   unsigned int iteration_;
Index: kernel/include/IMP/UnaryFunction.h
===================================================================
--- kernel/include/IMP/UnaryFunction.h	(revision 619)
+++ kernel/include/IMP/UnaryFunction.h	(working copy)
@@ -9,7 +9,7 @@
 
 #include "IMP_config.h"
 #include "base_types.h"
-#include "internal/RefCountedObject.h"
+#include "RefCountedObject.h"
 
 namespace IMP
 {
@@ -18,7 +18,7 @@
 /** These functors take a single feature value, and return a corresponding
     score (and optionally also the first derivative).
  */
-class IMPDLLEXPORT UnaryFunction : public internal::RefCountedObject
+class IMPDLLEXPORT UnaryFunction : public RefCountedObject
 {
 public:
   UnaryFunction() {}
Index: kernel/include/IMP/score_states/CoverBondsScoreState.h
===================================================================
--- kernel/include/IMP/score_states/CoverBondsScoreState.h	(revision 619)
+++ kernel/include/IMP/score_states/CoverBondsScoreState.h	(working copy)
@@ -11,7 +11,7 @@
 #include "../ScoreState.h"
 #include "BondDecoratorListScoreState.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 
 namespace IMP
 {
@@ -30,7 +30,7 @@
  */
 class IMPDLLEXPORT CoverBondsScoreState: public ScoreState
 {
-  internal::ObjectPointer<BondDecoratorListScoreState, true> bl_;
+  Pointer<BondDecoratorListScoreState> bl_;
   FloatKey rk_;
 public:
   /** Get the list of bonds from the BondDecoratorListScoreState. This list is
Index: kernel/include/IMP/score_states/BipartiteNonbondedListScoreState.h
===================================================================
--- kernel/include/IMP/score_states/BipartiteNonbondedListScoreState.h	(revision 619)
+++ kernel/include/IMP/score_states/BipartiteNonbondedListScoreState.h	(working copy)
@@ -43,7 +43,7 @@
   };
 protected:
   Algorithm a_;
-  internal::ObjectPointer<MaxChangeScoreState, true> mc0_, mc1_, mcr_;
+  Pointer<MaxChangeScoreState> mc0_, mc1_, mcr_;
 
   void process_sets(const Particles &p0,
                     const Particles &p1);
Index: kernel/include/IMP/score_states/AllNonbondedListScoreState.h
===================================================================
--- kernel/include/IMP/score_states/AllNonbondedListScoreState.h	(revision 619)
+++ kernel/include/IMP/score_states/AllNonbondedListScoreState.h	(working copy)
@@ -50,7 +50,7 @@
   };
 protected:
   Algorithm a_;
-  internal::ObjectPointer<MaxChangeScoreState, true> mc_, mcr_;
+  Pointer<MaxChangeScoreState> mc_, mcr_;
 
   void check_nbl() const;
 
Index: kernel/include/IMP/restraints/ConnectivityRestraint.h
===================================================================
--- kernel/include/IMP/restraints/ConnectivityRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/ConnectivityRestraint.h	(working copy)
@@ -50,7 +50,7 @@
 
 protected:
 
-    internal::ObjectPointer<PairScore, true> ps_;
+    Pointer<PairScore> ps_;
 
   //! The indices for the first particle in each set
   /** set_offset_[i] is the first index of set i and set_offset_[i+1] is 
Index: kernel/include/IMP/restraints/SingletonListRestraint.h
===================================================================
--- kernel/include/IMP/restraints/SingletonListRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/SingletonListRestraint.h	(working copy)
@@ -12,7 +12,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../SingletonScore.h"
 
 #include <iostream>
@@ -40,7 +40,7 @@
   using Restraint::set_particles;
 
 protected:
-  internal::ObjectPointer<SingletonScore, true> ss_;
+  Pointer<SingletonScore> ss_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/restraints/PairChainRestraint.h
===================================================================
--- kernel/include/IMP/restraints/PairChainRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/PairChainRestraint.h	(working copy)
@@ -12,7 +12,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../PairScore.h"
 
 #include <vector>
@@ -43,7 +43,7 @@
   void clear_chains();
 
 protected:
-  internal::ObjectPointer<PairScore, true> ts_;
+  Pointer<PairScore> ts_;
   std::vector<unsigned int> chain_splits_;
 };
 
Index: kernel/include/IMP/restraints/BondDecoratorRestraint.h
===================================================================
--- kernel/include/IMP/restraints/BondDecoratorRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/BondDecoratorRestraint.h	(working copy)
@@ -14,7 +14,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../UnaryFunction.h"
 
 namespace IMP
@@ -49,7 +49,7 @@
 
 protected:
   BondDecoratorListScoreState *bl_;
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/restraints/TunnelRestraint.h
===================================================================
--- kernel/include/IMP/restraints/TunnelRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/TunnelRestraint.h	(working copy)
@@ -39,7 +39,7 @@
   Vector3D center_;
   Float height_;
   Float radius_;
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
   FloatKey rk_;
 public:
   TunnelRestraint(UnaryFunction* f, FloatKey rk);
Index: kernel/include/IMP/restraints/AngleRestraint.h
===================================================================
--- kernel/include/IMP/restraints/AngleRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/AngleRestraint.h	(working copy)
@@ -11,7 +11,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../triplet_scores/AngleTripletScore.h"
 
 namespace IMP
@@ -35,7 +35,7 @@
   IMP_RESTRAINT(internal::kernel_version_info)
 
 protected:
-    internal::ObjectPointer<AngleTripletScore, true> sf_;
+    Pointer<AngleTripletScore> sf_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/restraints/NonbondedRestraint.h
===================================================================
--- kernel/include/IMP/restraints/NonbondedRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/NonbondedRestraint.h	(working copy)
@@ -14,7 +14,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../score_states/NonbondedListScoreState.h"
 
 namespace IMP
@@ -41,8 +41,8 @@
   IMP_RESTRAINT(internal::kernel_version_info)
 
 protected:
-  internal::ObjectPointer<NonbondedListScoreState, true> nbl_;
-  internal::ObjectPointer<PairScore, true> sf_;
+  Pointer<NonbondedListScoreState> nbl_;
+  Pointer<PairScore> sf_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/restraints/TripletChainRestraint.h
===================================================================
--- kernel/include/IMP/restraints/TripletChainRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/TripletChainRestraint.h	(working copy)
@@ -12,7 +12,7 @@
 #include "../IMP_config.h"
 #include "../Restraint.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../TripletScore.h"
 
 #include <vector>
@@ -43,7 +43,7 @@
   void clear_chains();
 
 protected:
-  internal::ObjectPointer<TripletScore, true> ts_;
+  Pointer<TripletScore> ts_;
   std::vector<unsigned int> chain_splits_;
 };
 
Index: kernel/include/IMP/restraints/PairListRestraint.h
===================================================================
--- kernel/include/IMP/restraints/PairListRestraint.h	(revision 619)
+++ kernel/include/IMP/restraints/PairListRestraint.h	(working copy)
@@ -13,7 +13,7 @@
 #include "../Restraint.h"
 #include "../Particle.h"
 #include "../internal/kernel_version_info.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../PairScore.h"
 
 #include <iostream>
@@ -41,7 +41,7 @@
   void add_particle_pairs(const ParticlePairs &ps);
 
 protected:
-  internal::ObjectPointer<PairScore, true> ss_;
+  Pointer<PairScore> ss_;
 };
 
 } // namespace IMP
Index: kernel/include/IMP/Restraint.h
===================================================================
--- kernel/include/IMP/Restraint.h	(revision 619)
+++ kernel/include/IMP/Restraint.h	(working copy)
@@ -13,8 +13,8 @@
 #include "Model.h"
 #include "Particle.h"
 #include "VersionInfo.h"
-#include "internal/Object.h"
-#include "internal/ObjectPointer.h"
+#include "Object.h"
+#include "Pointer.h"
 #include "log.h"
 #include "utility.h"
 
@@ -52,7 +52,7 @@
     \note Physical restraints should use the units of kcal/mol for restraint
     values and kcal/mol/A for derivatives.
  */
-class IMPDLLEXPORT Restraint : public internal::RefCountedObject
+class IMPDLLEXPORT Restraint : public RefCountedObject
 {
 public:
   //! Initialize the Restraint
@@ -100,7 +100,7 @@
   IMP_LIST(protected, Particle, particle, Particle*)
 
 private:
-  internal::ObjectPointer<Model, false> model_;
+  Pointer<Model> model_;
 
   /* True if restraint has not been deactivated.
      If it is not active, evaluate should not be called
Index: kernel/include/IMP/DecoratorBase.h
===================================================================
--- kernel/include/IMP/DecoratorBase.h	(revision 619)
+++ kernel/include/IMP/DecoratorBase.h	(working copy)
@@ -8,8 +8,8 @@
 #ifndef __IMP_DECORATOR_BASE_H
 #define __IMP_DECORATOR_BASE_H
 
-#include "internal/Object.h"
-#include "internal/ObjectPointer.h"
+#include "Object.h"
+#include "Pointer.h"
 #include "Particle.h"
 
 namespace IMP
@@ -21,7 +21,7 @@
 class IMPDLLEXPORT DecoratorBase
 {
 protected:
-  internal::ObjectPointer<Particle, true> particle_;
+  Pointer<Particle> particle_;
   DecoratorBase(Particle *p): particle_(p) {}
   bool is_default() const {
     return !particle_;
Index: kernel/include/IMP/ParticleRefiner.h
===================================================================
--- kernel/include/IMP/ParticleRefiner.h	(revision 619)
+++ kernel/include/IMP/ParticleRefiner.h	(working copy)
@@ -10,7 +10,7 @@
 #include "IMP_config.h"
 #include "base_types.h"
 #include "VersionInfo.h"
-#include "internal/RefCountedObject.h"
+#include "RefCountedObject.h"
 
 namespace IMP
 {
@@ -22,7 +22,7 @@
 /** The job of this class is to take a single particle and, if 
     appropriate, return a list of particles.
 */
-class IMPDLLEXPORT ParticleRefiner : public internal::RefCountedObject
+class IMPDLLEXPORT ParticleRefiner : public RefCountedObject
 {
 public:
   ParticleRefiner() {}
Index: kernel/include/IMP/optimizers/MonteCarlo.h
===================================================================
--- kernel/include/IMP/optimizers/MonteCarlo.h	(revision 619)
+++ kernel/include/IMP/optimizers/MonteCarlo.h	(working copy)
@@ -97,7 +97,7 @@
   Float prior_energy_;
   Float stop_energy_;
   Float probability_;
-  internal::ObjectPointer<Optimizer, true> cg_;
+  Pointer<Optimizer> cg_;
   unsigned int num_local_steps_;
   unsigned int stat_forward_steps_taken_;
   unsigned int stat_upward_steps_taken_;
Index: kernel/include/IMP/optimizers/Mover.h
===================================================================
--- kernel/include/IMP/optimizers/Mover.h	(revision 619)
+++ kernel/include/IMP/optimizers/Mover.h	(working copy)
@@ -10,8 +10,8 @@
 
 #include "../IMP_config.h"
 #include "../base_types.h"
-#include "../internal/Object.h"
-#include "../internal/ObjectPointer.h"
+#include "../Object.h"
+#include "../Pointer.h"
 #include "../Optimizer.h"
 
 #include <vector>
@@ -32,7 +32,7 @@
 //! A class to make a monte carlo move.
 /** You probably want to use MoverBase if you are implementing a Mover.
  */
-class IMPDLLEXPORT Mover: public internal::Object
+class IMPDLLEXPORT Mover: public Object
 {
   friend class MonteCarlo;
   void set_optimizer(Optimizer *c, MoverIndex i) {
@@ -40,7 +40,7 @@
     index_=i;
   }
 
-  internal::ObjectPointer<Optimizer, false> opt_;
+  Pointer<Optimizer> opt_;
   MoverIndex index_;
 public:
   Mover();
Index: kernel/include/IMP/OptimizerState.h
===================================================================
--- kernel/include/IMP/OptimizerState.h	(revision 619)
+++ kernel/include/IMP/OptimizerState.h	(working copy)
@@ -10,8 +10,8 @@
 
 #include "IMP_config.h"
 #include "VersionInfo.h"
-#include "internal/RefCountedObject.h"
-#include "internal/ObjectPointer.h"
+#include "RefCountedObject.h"
+#include "Pointer.h"
 #include "Optimizer.h"
 
 #include <iostream>
@@ -33,7 +33,7 @@
     logging is TERSE the restraint should print out only a constant number
     of lines per update call.
  */
-class IMPDLLEXPORT OptimizerState : public internal::Object
+class IMPDLLEXPORT OptimizerState : public Object
 {
   friend class Optimizer;
   void set_optimizer(Optimizer* optimizer);
@@ -64,7 +64,7 @@
   }
 protected:
   //! Stored optimizer
-  internal::ObjectPointer<Optimizer, false> optimizer_;
+  Pointer<Optimizer> optimizer_;
 };
 
 IMP_OUTPUT_OPERATOR(OptimizerState);
Index: kernel/include/IMP/pair_scores/SphereDistancePairScore.h
===================================================================
--- kernel/include/IMP/pair_scores/SphereDistancePairScore.h	(revision 619)
+++ kernel/include/IMP/pair_scores/SphereDistancePairScore.h	(working copy)
@@ -9,7 +9,7 @@
 #define __IMP_SPHERE_DISTANCE_PAIR_SCORE_H
 
 #include "../PairScore.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 #include "../UnaryFunction.h"
 
 namespace IMP
@@ -20,7 +20,7 @@
  */
 class IMPDLLEXPORT SphereDistancePairScore : public PairScore
 {
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
   FloatKey radius_;
 public:
   SphereDistancePairScore(UnaryFunction *f, 
Index: kernel/include/IMP/pair_scores/TypedPairScore.h
===================================================================
--- kernel/include/IMP/pair_scores/TypedPairScore.h	(revision 619)
+++ kernel/include/IMP/pair_scores/TypedPairScore.h	(working copy)
@@ -58,14 +58,14 @@
   void set_pair_score(PairScore *ps, Int atype, Int btype) {
     score_map_[std::pair<Int,Int>(std::min(atype, btype),
                                   std::max(atype, btype))]
-        = internal::ObjectPointer<PairScore, true>(ps);
+        = Pointer<PairScore>(ps);
   }
 
 protected:
   //! The key used for the particle types.
   IntKey typekey_;
   typedef std::map<std::pair<Int,Int>,
-                   internal::ObjectPointer<PairScore, true> > ScoreMap;
+                   Pointer<PairScore> > ScoreMap;
   //! Mapping from particle types to PairScores.
   ScoreMap score_map_;
   //! Whether to throw an exception for invalid particle types.
Index: kernel/include/IMP/pair_scores/DistancePairScore.h
===================================================================
--- kernel/include/IMP/pair_scores/DistancePairScore.h	(revision 619)
+++ kernel/include/IMP/pair_scores/DistancePairScore.h	(working copy)
@@ -10,7 +10,7 @@
 
 #include "../PairScore.h"
 #include "../UnaryFunction.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 
 namespace IMP
 {
@@ -20,7 +20,7 @@
  */
 class IMPDLLEXPORT DistancePairScore : public PairScore
 {
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
 public:
   DistancePairScore(UnaryFunction *f);
   virtual ~DistancePairScore(){}
Index: kernel/include/IMP/pair_scores/RefineOncePairScore.h
===================================================================
--- kernel/include/IMP/pair_scores/RefineOncePairScore.h	(revision 619)
+++ kernel/include/IMP/pair_scores/RefineOncePairScore.h	(working copy)
@@ -11,7 +11,7 @@
 #include "../PairScore.h"
 #include "../UnaryFunction.h"
 #include "../ParticleRefiner.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 
 namespace IMP
 {
@@ -24,8 +24,8 @@
  */
 class IMPDLLEXPORT RefineOncePairScore : public PairScore
 {
-  internal::ObjectPointer<ParticleRefiner, true> r_;
-  internal::ObjectPointer<PairScore, true> f_;
+  Pointer<ParticleRefiner> r_;
+  Pointer<PairScore> f_;
 
 public:
   /** \param[in] r The ParticleRefiner to call on each particle
Index: kernel/include/IMP/RefCountedObject.h
===================================================================
--- kernel/include/IMP/RefCountedObject.h	(revision 619)
+++ kernel/include/IMP/RefCountedObject.h	(working copy)
@@ -17,9 +17,6 @@
 namespace IMP
 {
 
-namespace internal
-{
-
 //! Common base class for ref counted objects.
 /** This class acts as a tag rather than providing any functionality.
 
@@ -48,125 +45,6 @@
   }
 };
 
-
-
-template <bool REF>
-struct Ref
-{
-  template <class O>
-  static void eval(O* o) {
-    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
-    IMP_LOG(VERBOSE, "Not refing particle " << o << std::endl);
-  }
-};
-
-template <>
-struct Ref<true>
-{
-  template <class O>
-  static void eval(O* o) {
-    IMP_LOG(VERBOSE, "Refing particle " << o->get_index() 
-            << o->get_ref_count() << std::endl);
-    o->assert_is_valid();
-    o->ref();
-  }
-};
-
-template <bool REF>
-struct UnRef
-{
-  template <class O>
-  static void eval(O* o) {
-    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
-    IMP_LOG(VERBOSE, "Not Unrefing object " << o << std::endl);
-  }
-};
-
-template <>
-struct UnRef<true>
-{
-  template <class O>
-  static void eval(O *o) {
-    IMP_LOG(VERBOSE, "Unrefing particle " << o->get_index()
-            << " " << o->get_ref_count() << std::endl);
-    o->assert_is_valid();
-    o->unref();
-    if (!o->get_has_ref()) {
-      delete o;
-    }
-  }
-  };
-
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void unref(O o)
-{
-  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void ref(O o)
-{
-  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
-}
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void unref(O* o)
-{
-  UnRef<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void ref(O* o)
-{
-  Ref<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
-}
-
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void disown(O* o)
-{
-  /*IMP_LOG(VERBOSE, "Disown called with " 
-          << (boost::is_base_of<RefCountedObject, O >::value)
-          << " for " << o << " " << o->get_ref_count() << std::endl);*/
-  o->unref();
-  if (!o->get_has_ref()) {
-    delete o;
-  }
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void own(O* o)
-{
-  /*IMP_LOG(VERBOSE, "Own called with "
-          << (boost::is_base_of<RefCountedObject, O >::value)
-          << " for " << o
-          << " " << o->get_ref_count() << std::endl);*/
-  if (boost::is_base_of<RefCountedObject, O >::value) {
-    // no checks
-  } else {
-    IMP_check(!o->get_has_ref(), "Trying to own already owned but "
-              << "non-reference-counted object: " << *o,
-              ValueException);
-  }
-  o->ref();
-}
-
-
-
-
-
-} // namespace internal
-
 } // namespace IMP
 
 #endif  /* __IMP_REF_COUNTED_OBJECT_H */
Index: kernel/include/IMP/internal/SConscript
===================================================================
--- kernel/include/IMP/internal/SConscript	(revision 619)
+++ kernel/include/IMP/internal/SConscript	(working copy)
@@ -2,9 +2,9 @@
 Import('env')
 
 files = ['AttributeTable.h',  'graph_base.h',  'Grid3D.h', 'Vector.h',
-         'Object.h', 'ObjectPointer.h', 'ObjectContainer.h', 'ParticleGrid.h',
+         'ref_counting.h', 'ObjectContainer.h', 'ParticleGrid.h',
          'kernel_version_info.h', 'constants.h', 'units.h',
-         'RefCountedObject.h', 'utility.h', 'bbox_nbl_helpers.h',
+         'utility.h', 'bbox_nbl_helpers.h',
          'ArrayOnAttributesHelper.h', 'Unit.h', 'ExponentialNumber.h']
 
 # Install the include files:
Index: kernel/include/IMP/internal/Vector.h
===================================================================
--- kernel/include/IMP/internal/Vector.h	(revision 619)
+++ kernel/include/IMP/internal/Vector.h	(working copy)
@@ -9,8 +9,9 @@
 #define __IMP_VECTOR_H
 
 #include "../exception.h"
-#include "Object.h"
-#include "RefCountedObject.h"
+#include "../Object.h"
+#include "../RefCountedObject.h"
+#include "ref_counting.h"
 
 #include <vector>
 
Index: kernel/include/IMP/internal/units.h
===================================================================
--- kernel/include/IMP/internal/units.h	(revision 619)
+++ kernel/include/IMP/internal/units.h	(working copy)
@@ -119,6 +119,8 @@
 typedef Multiply<Multiply<Centimeter, Centimeter>::type,
                       Centimeter>::type CubicCentimeter;
 typedef Divide<Gram, CubicCentimeter>::type GramPerCubicCentimeter;
+typedef Shift<Second, -9>::type NanoSecond;
+typedef Shift<Second, -15>::type FemtoSecond;
 
 
 
Index: kernel/include/IMP/internal/Object.h
===================================================================
--- kernel/include/IMP/internal/Object.h	(revision 619)
+++ kernel/include/IMP/internal/Object.h	(working copy)
@@ -1,72 +0,0 @@
-/**
- *  \file Object.h     
- *  \brief A shared base class to help in debugging and things.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#ifndef __IMP_OBJECT_H
-#define __IMP_OBJECT_H
-
-#include "../exception.h"
-
-namespace IMP
-{
-
-namespace internal
-{
-
-//! Common base class for IMP objects.
-/** Currently this just makes the object noncopyable and adds heuristic checks
-    to make sure the memory has not been freed. 
-
-    \note Do not use NDEBUG to remove check_value_ as that changes the memory
-    layout and causes bad things to happen. It should get wrapped in some
-    sort of macro later.
-
-    \note This has ref and unref methods to simplifity ObjectContainer.
-    For Object, the reference count can be at most 1.
-
-    \internal
- */
-class IMPDLLEXPORT Object
-{
-protected:
-  Object();
-  ~Object();
-
-public:
-  //! Throw an assertion if the object has been freed
-  void assert_is_valid() const;
-
-  bool get_has_ref() const {return count_ != 0;}
-
-  void ref() {
-    assert_is_valid();
-    ++count_;
-  }
-
-  void unref() {
-    assert_is_valid();
-    IMP_assert(count_ !=0, "Too many unrefs on object");
-    --count_;
-  }
-
-  unsigned int get_ref_count() const {
-    return count_;
-  }
-
-private:
-  Object(const Object &o){}
-  const internal::Object& operator=(const Object &o) {return *this;}
-
-  int count_;
-  double check_value_;
-};
-
-} // namespace internal
-
-} // namespace IMP
-
-#endif  /* __IMP_OBJECT_H */
Index: kernel/include/IMP/internal/ObjectPointer.h
===================================================================
--- kernel/include/IMP/internal/ObjectPointer.h	(revision 619)
+++ kernel/include/IMP/internal/ObjectPointer.h	(working copy)
@@ -1,116 +0,0 @@
-/**
- *  \file ObjectPointer.h
- *  \brief A NULL-initialized pointer to an IMP Object.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#ifndef __IMP_OBJECT_POINTER_H
-#define __IMP_OBJECT_POINTER_H
-
-#include "../log.h"
-#include "Object.h"
-#include "RefCountedObject.h"
-#include "../macros.h"
-#include "../exception.h"
-
-#include <boost/static_assert.hpp>
-#include <boost/type_traits.hpp>
-
-namespace IMP
-{
-
-namespace internal
-{
-
-//! A pointer to an IMP::Object
-/** The pointer is NULL initialized and checks accesses to throw an exception
-    rather than core dump on an invalid access. 
-    \param[in] O The type of IMP::Object-derived object to point to
-    \param[in] RC If true, the pointer is refcounted.
- */
-template <class O, bool RC>
-class ObjectPointer
-{
-  typedef ObjectPointer<O, RC> This;
-  O* o_;
-
-  void set_pointer(O* p) {
-    if (RC) {
-      if (o_) disown(o_);
-      if (p) own(p);
-      o_=p;
-    } else {
-      o_=p;
-    }
-  }
-
-  // Enforce that ref counted objects are ref counted
-  BOOST_STATIC_ASSERT((RC || !boost::is_base_of<RefCountedObject, O>::value));
-
-  void audit() const {
-    IMP_assert(o_ != NULL, "Pointer is NULL");
-    IMP_CHECK_OBJECT(o_);
-  }
-
-  bool is_default() const {
-    return o_==NULL;
-  }
-  typedef bool (This::*unspecified_bool)() const;
-
-public:
-  ObjectPointer(const ObjectPointer &o): o_(NULL) {
-    set_pointer(o.o_);
-  }
-  ObjectPointer& operator=(const ObjectPointer &o){
-    set_pointer(o.o_);
-    return *this;
-  }
-  ObjectPointer(): o_(NULL) {}
-  explicit ObjectPointer(O* o): o_(NULL) {
-    IMP_assert(o, "Can't initialize with NULL pointer");
-    set_pointer(o);
-  }
-  ~ObjectPointer(){
-    set_pointer(NULL);
-  }
-  const O& operator*() const {
-    audit();
-    return *o_;
-  }
-  O& operator*()  {
-    audit();
-    return *o_;
-  }
-  const O* operator->() const {
-    audit();
-    return o_;
-  }
-  O* operator->()  {
-    audit();
-    return o_;
-  }
-  O* get() const {
-    audit();
-    return o_;
-  }
-  void operator=(O* o) {
-    set_pointer(o);
-  }
-  IMP_COMPARISONS_1(o_);
-
-  bool operator!() const {
-    return !o_;
-  }
-
-  operator unspecified_bool() const {
-    return o_ ? &This::operator! : 0;
-  }
-};
-
-} // namespace internal
-
-} // namespace IMP
-
-#endif  /* __IMP_OBJECT_POINTER_H */
Index: kernel/include/IMP/internal/ObjectContainer.h
===================================================================
--- kernel/include/IMP/internal/ObjectContainer.h	(revision 619)
+++ kernel/include/IMP/internal/ObjectContainer.h	(working copy)
@@ -8,8 +8,9 @@
 #ifndef __IMP_OBJECT_CONTAINER_H
 #define __IMP_OBJECT_CONTAINER_H
 
-#include "Object.h"
-#include "RefCountedObject.h"
+#include "../Object.h"
+#include "../RefCountedObject.h"
+#include "ref_counting.h"
 
 #include <boost/iterator/filter_iterator.hpp>
 
Index: kernel/include/IMP/internal/ParticleGrid.h
===================================================================
--- kernel/include/IMP/internal/ParticleGrid.h	(revision 619)
+++ kernel/include/IMP/internal/ParticleGrid.h	(working copy)
@@ -11,7 +11,7 @@
 #include "Grid3D.h"
 #include "../score_states/MaxChangeScoreState.h"
 #include "../base_types.h"
-#include "ObjectPointer.h"
+#include "../Pointer.h"
 
 namespace IMP
 {
@@ -20,7 +20,7 @@
 {
 
 /** \internal */
-class ParticleGrid: public internal::Object
+class ParticleGrid: public Object
 {
   // don't need ref counting since mc_ has the same set of points
   typedef internal::Grid3D<Particles> Grid;
Index: kernel/include/IMP/internal/AttributeTable.h
===================================================================
--- kernel/include/IMP/internal/AttributeTable.h	(revision 619)
+++ kernel/include/IMP/internal/AttributeTable.h	(working copy)
@@ -11,7 +11,7 @@
 #include "../base_types.h"
 #include "../utility.h"
 #include "../log.h"
-#include "ObjectPointer.h"
+#include "../Pointer.h"
 
 #include <boost/iterator/filter_iterator.hpp>
 #include <boost/iterator/counting_iterator.hpp>
Index: kernel/include/IMP/internal/ref_counting.h
===================================================================
--- kernel/include/IMP/internal/ref_counting.h	(revision 0)
+++ kernel/include/IMP/internal/ref_counting.h	(revision 0)
@@ -0,0 +1,143 @@
+/**
+ *  \file ref_counting.h     
+ *  \brief Helpers to handle reference counting.
+ *
+ *  Copyright 2007-8 Sali Lab. All rights reserved.
+ *
+ */
+
+#ifndef __IMP_REF_COUNTING_H
+#define __IMP_REF_COUNTING_H
+
+#include "../Object.h"
+#include "../RefCountedObject.h"
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits.hpp>
+
+namespace IMP
+{
+
+namespace internal
+{
+
+template <bool REF>
+struct Ref
+{
+  template <class O>
+  static void eval(O* o) {
+    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
+    IMP_LOG(VERBOSE, "Not refing particle " << o << std::endl);
+  }
+};
+
+template <>
+struct Ref<true>
+{
+  template <class O>
+  static void eval(O* o) {
+    IMP_LOG(VERBOSE, "Refing particle " << o->get_index() 
+            << o->get_ref_count() << std::endl);
+    o->assert_is_valid();
+    o->ref();
+  }
+};
+
+template <bool REF>
+struct UnRef
+{
+  template <class O>
+  static void eval(O* o) {
+    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
+    IMP_LOG(VERBOSE, "Not Unrefing object " << o << std::endl);
+  }
+};
+
+template <>
+struct UnRef<true>
+{
+  template <class O>
+  static void eval(O *o) {
+    IMP_LOG(VERBOSE, "Unrefing particle " << o->get_index()
+            << " " << o->get_ref_count() << std::endl);
+    o->assert_is_valid();
+    o->unref();
+    if (!o->get_has_ref()) {
+      delete o;
+    }
+  }
+  };
+
+
+//! Can be called on any object and will only unref it if appropriate
+template <class O>
+void unref(O o)
+{
+  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
+}
+
+
+//! Can be called on any object and will only ref it if appropriate
+template <class O>
+void ref(O o)
+{
+  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
+}
+
+//! Can be called on any object and will only unref it if appropriate
+template <class O>
+void unref(O* o)
+{
+  UnRef<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
+}
+
+
+//! Can be called on any object and will only ref it if appropriate
+template <class O>
+void ref(O* o)
+{
+  Ref<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
+}
+
+
+//! Can be called on any object and will only unref it if appropriate
+template <class O>
+void disown(O* o)
+{
+  /*IMP_LOG(VERBOSE, "Disown called with " 
+          << (boost::is_base_of<RefCountedObject, O >::value)
+          << " for " << o << " " << o->get_ref_count() << std::endl);*/
+  o->unref();
+  if (!o->get_has_ref()) {
+    delete o;
+  }
+}
+
+
+//! Can be called on any object and will only ref it if appropriate
+template <class O>
+void own(O* o)
+{
+  /*IMP_LOG(VERBOSE, "Own called with "
+          << (boost::is_base_of<RefCountedObject, O >::value)
+          << " for " << o
+          << " " << o->get_ref_count() << std::endl);*/
+  if (boost::is_base_of<RefCountedObject, O >::value) {
+    // no checks
+  } else {
+    IMP_check(!o->get_has_ref(), "Trying to own already owned but "
+              << "non-reference-counted object: " << *o,
+              ValueException);
+  }
+  o->ref();
+}
+
+
+
+
+
+} // namespace internal
+
+} // namespace IMP
+
+#endif  /* __IMP_REF_COUNTING_H */
Index: kernel/include/IMP/internal/RefCountedObject.h
===================================================================
--- kernel/include/IMP/internal/RefCountedObject.h	(revision 619)
+++ kernel/include/IMP/internal/RefCountedObject.h	(working copy)
@@ -1,172 +0,0 @@
-/**
- *  \file RefCountedObject.h     
- *  \brief A common base class for ref counted objects.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#ifndef __IMP_REF_COUNTED_OBJECT_H
-#define __IMP_REF_COUNTED_OBJECT_H
-
-#include "Object.h"
-
-#include <boost/static_assert.hpp>
-#include <boost/type_traits.hpp>
-
-namespace IMP
-{
-
-namespace internal
-{
-
-//! Common base class for ref counted objects.
-/** This class acts as a tag rather than providing any functionality.
-
-   \internal
- */
-class IMPDLLEXPORT RefCountedObject: public Object
-{
-  typedef Object P;
-  typedef RefCountedObject This;
-  static unsigned int live_objects_;
-protected:
-  RefCountedObject() {
-     ++live_objects_;
-  }
-
-public:
-
-  virtual ~RefCountedObject() {
-    IMP_assert(!get_has_ref(), "Deleting object which still has references");
-    --live_objects_;
-  }
-
-  static unsigned int get_number_of_live_objects() {
-    // for debugging purposes only
-    return live_objects_;
-  }
-};
-
-
-
-template <bool REF>
-struct Ref
-{
-  template <class O>
-  static void eval(O* o) {
-    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
-    IMP_LOG(VERBOSE, "Not refing particle " << o << std::endl);
-  }
-};
-
-template <>
-struct Ref<true>
-{
-  template <class O>
-  static void eval(O* o) {
-    IMP_LOG(VERBOSE, "Refing particle " << o->get_index() 
-            << o->get_ref_count() << std::endl);
-    o->assert_is_valid();
-    o->ref();
-  }
-};
-
-template <bool REF>
-struct UnRef
-{
-  template <class O>
-  static void eval(O* o) {
-    BOOST_STATIC_ASSERT((!boost::is_base_of<RefCountedObject, O >::value));
-    IMP_LOG(VERBOSE, "Not Unrefing object " << o << std::endl);
-  }
-};
-
-template <>
-struct UnRef<true>
-{
-  template <class O>
-  static void eval(O *o) {
-    IMP_LOG(VERBOSE, "Unrefing particle " << o->get_index()
-            << " " << o->get_ref_count() << std::endl);
-    o->assert_is_valid();
-    o->unref();
-    if (!o->get_has_ref()) {
-      delete o;
-    }
-  }
-  };
-
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void unref(O o)
-{
-  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void ref(O o)
-{
-  BOOST_STATIC_ASSERT(!boost::is_pointer<O>::value);
-}
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void unref(O* o)
-{
-  UnRef<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void ref(O* o)
-{
-  Ref<(boost::is_base_of<RefCountedObject, O >::value)>::eval(o);
-}
-
-
-//! Can be called on any object and will only unref it if appropriate
-template <class O>
-void disown(O* o)
-{
-  /*IMP_LOG(VERBOSE, "Disown called with " 
-          << (boost::is_base_of<RefCountedObject, O >::value)
-          << " for " << o << " " << o->get_ref_count() << std::endl);*/
-  o->unref();
-  if (!o->get_has_ref()) {
-    delete o;
-  }
-}
-
-
-//! Can be called on any object and will only ref it if appropriate
-template <class O>
-void own(O* o)
-{
-  /*IMP_LOG(VERBOSE, "Own called with "
-          << (boost::is_base_of<RefCountedObject, O >::value)
-          << " for " << o
-          << " " << o->get_ref_count() << std::endl);*/
-  if (boost::is_base_of<RefCountedObject, O >::value) {
-    // no checks
-  } else {
-    IMP_check(!o->get_has_ref(), "Trying to own already owned but "
-              << "non-reference-counted object: " << *o,
-              ValueException);
-  }
-  o->ref();
-}
-
-
-
-
-
-} // namespace internal
-
-} // namespace IMP
-
-#endif  /* __IMP_REF_COUNTED_OBJECT_H */
Index: kernel/include/IMP/PairScore.h
===================================================================
--- kernel/include/IMP/PairScore.h	(revision 619)
+++ kernel/include/IMP/PairScore.h	(working copy)
@@ -9,7 +9,7 @@
 
 #include "IMP_config.h"
 #include "base_types.h"
-#include "internal/RefCountedObject.h"
+#include "RefCountedObject.h"
 #include "Particle.h"
 #include "DerivativeAccumulator.h"
 
@@ -25,7 +25,7 @@
 /** PairScores should take a UnaryFunction as their first
     argument if such is needed.
 */
-class IMPDLLEXPORT PairScore : public internal::RefCountedObject
+class IMPDLLEXPORT PairScore : public RefCountedObject
 {
 public:
   PairScore() {}
Index: kernel/include/IMP/SConscript
===================================================================
--- kernel/include/IMP/SConscript	(revision 619)
+++ kernel/include/IMP/SConscript	(working copy)
@@ -7,7 +7,8 @@
          'Key.h', 'utility.h', 'Restraint.h', 'Optimizer.h',
          'DecoratorBase.h', 'Vector3D.h',
          'UnaryFunction.h', 'PairScore.h', 'SingletonScore.h', 'macros.h',
-         'TripletScore.h', 'exception.h', 'VersionInfo.h']
+         'TripletScore.h', 'exception.h', 'VersionInfo.h',
+         'Object.h', 'Pointer.h', 'RefCountedObject.h']
 
 # Install the include files:
 includedir = os.path.join(env['includedir'], 'IMP')
Index: kernel/include/IMP/Particle.h
===================================================================
--- kernel/include/IMP/Particle.h	(revision 619)
+++ kernel/include/IMP/Particle.h	(working copy)
@@ -11,12 +11,12 @@
 #include "IMP_config.h"
 #include "base_types.h"
 #include "Model.h"
-#include "internal/Object.h"
+#include "Object.h"
 #include "utility.h"
 #include "Key.h"
 #include "internal/AttributeTable.h"
 #include "DerivativeAccumulator.h"
-#include "internal/ObjectPointer.h"
+#include "Pointer.h"
 
 #include <limits>
 
@@ -49,17 +49,17 @@
 
     \ingroup kernel
  */
-class IMPDLLEXPORT Particle : public internal::RefCountedObject
+class IMPDLLEXPORT Particle : public RefCountedObject
 {
   friend class Model;
 
   /* This has to be declared here since boost 1.35 wants the full
-     definition of Particle to be available when the ObjectPointer
+     definition of Particle to be available when the Pointer
      is declared.
   */
   struct ParticleAttributeTableTraits
   {
-    typedef internal::ObjectPointer<Particle, true> Value;
+    typedef Pointer<Particle> Value;
     typedef KeyBase<Particle*> Key;
     static Value get_invalid() {
       return Value();
@@ -369,7 +369,7 @@
   // Set pointer to model particle data.
   void set_model(Model *md, ParticleIndex pi);
 
-  internal::ObjectPointer<Model, false> model_;
+  Pointer<Model> model_;
 
   // true if particle is active
   bool is_active_;
@@ -526,7 +526,7 @@
 {
   IMP_check(get_is_active(), "Do not touch inactive particles",
             InactiveParticleException);
-  particles_.set_value(name, internal::ObjectPointer<Particle, true>(value));
+  particles_.set_value(name, Pointer<Particle>(value));
 }
 
 
@@ -580,7 +580,7 @@
   IMP_assert(model_,
              "Particle must be added to Model before attributes are added");
   particles_.insert(name,
-                           internal::ObjectPointer<Particle, true>(value));
+                           Pointer<Particle>(value));
 }
 
 
Index: kernel/include/IMP/Object.h
===================================================================
--- kernel/include/IMP/Object.h	(revision 619)
+++ kernel/include/IMP/Object.h	(working copy)
@@ -9,14 +9,11 @@
 #ifndef __IMP_OBJECT_H
 #define __IMP_OBJECT_H
 
-#include "../exception.h"
+#include "exception.h"
 
 namespace IMP
 {
 
-namespace internal
-{
-
 //! Common base class for IMP objects.
 /** Currently this just makes the object noncopyable and adds heuristic checks
     to make sure the memory has not been freed. 
@@ -59,14 +56,12 @@
 
 private:
   Object(const Object &o){}
-  const internal::Object& operator=(const Object &o) {return *this;}
+  const Object& operator=(const Object &o) {return *this;}
 
   int count_;
   double check_value_;
 };
 
-} // namespace internal
-
 } // namespace IMP
 
 #endif  /* __IMP_OBJECT_H */
Index: kernel/include/IMP/triplet_scores/AngleTripletScore.h
===================================================================
--- kernel/include/IMP/triplet_scores/AngleTripletScore.h	(revision 619)
+++ kernel/include/IMP/triplet_scores/AngleTripletScore.h	(working copy)
@@ -10,7 +10,7 @@
 
 #include "../TripletScore.h"
 #include "../UnaryFunction.h"
-#include "../internal/ObjectPointer.h"
+#include "../Pointer.h"
 
 namespace IMP
 {
@@ -21,7 +21,7 @@
  */
 class IMPDLLEXPORT AngleTripletScore : public TripletScore
 {
-  internal::ObjectPointer<UnaryFunction, true> f_;
+  Pointer<UnaryFunction> f_;
 public:
   AngleTripletScore(UnaryFunction *f);
   virtual ~AngleTripletScore(){}
Index: kernel/include/IMP/ScoreState.h
===================================================================
--- kernel/include/IMP/ScoreState.h	(revision 619)
+++ kernel/include/IMP/ScoreState.h	(working copy)
@@ -9,8 +9,8 @@
 #define __IMP_SCORE_STATE_H
 
 #include "IMP_config.h"
-#include "internal/RefCountedObject.h"
-#include "internal/ObjectPointer.h"
+#include "RefCountedObject.h"
+#include "Pointer.h"
 #include "Model.h"
 #include "DerivativeAccumulator.h"
 #include "VersionInfo.h"
@@ -37,7 +37,7 @@
     of lines per update call.
 
  */
-class IMPDLLEXPORT ScoreState : public internal::RefCountedObject
+class IMPDLLEXPORT ScoreState : public RefCountedObject
 {
   friend class Model;
   void set_model(Model* model);
@@ -121,7 +121,7 @@
   unsigned int update_iteration_;
   unsigned int after_iteration_;
   // all of the particle data
-  internal::ObjectPointer<Model, false> model_;
+  Pointer<Model> model_;
   std::string name_;
 };
 
Index: kernel/include/IMP/TripletScore.h
===================================================================
--- kernel/include/IMP/TripletScore.h	(revision 619)
+++ kernel/include/IMP/TripletScore.h	(working copy)
@@ -9,7 +9,7 @@
 
 #include "IMP_config.h"
 #include "base_types.h"
-#include "internal/RefCountedObject.h"
+#include "RefCountedObject.h"
 #include "Particle.h"
 #include "DerivativeAccumulator.h"
 
@@ -26,7 +26,7 @@
 /** TripletScores should take a UnaryFunction as their first
     argument if such is needed.
 */
-class IMPDLLEXPORT TripletScore : public internal::RefCountedObject
+class IMPDLLEXPORT TripletScore : public RefCountedObject
 {
 public:
   TripletScore() {}
Index: kernel/include/IMP/Pointer.h
===================================================================
--- kernel/include/IMP/Pointer.h	(revision 0)
+++ kernel/include/IMP/Pointer.h	(revision 0)
@@ -0,0 +1,113 @@
+/**
+ *  \file Pointer.h
+ *  \brief A NULL-initialized pointer to an IMP Object.
+ *
+ *  Copyright 2007-8 Sali Lab. All rights reserved.
+ *
+ */
+
+#ifndef __IMP_POINTER_H
+#define __IMP_POINTER_H
+
+#include "log.h"
+#include "Object.h"
+#include "RefCountedObject.h"
+#include "internal/ref_counting.h"
+#include "macros.h"
+#include "exception.h"
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits.hpp>
+
+namespace IMP
+{
+
+//! A pointer to an IMP::Object
+/** The pointer is NULL initialized and checks accesses to throw an exception
+    rather than core dump on an invalid access. These should be used to hold
+    all pointers to IMP objects in C++ code.
+
+    The pointer will be ref counted if the object is one which should be ref 
+    counted (that is, if the object inherits from RefCountedObject).
+
+    \param[in] O The type of IMP::Object-derived object to point to
+ */
+template <class O>
+class Pointer
+{
+  typedef Pointer<O> This;
+  O* o_;
+
+  void set_pointer(O* p) {
+    if (boost::is_base_of<RefCountedObject, O>::value) {
+      if (o_) internal::disown(o_);
+      if (p) internal::own(p);
+      o_=p;
+    } else {
+      o_=p;
+    }
+  }
+
+  void audit() const {
+    IMP_assert(o_ != NULL, "Pointer is NULL");
+    IMP_CHECK_OBJECT(o_);
+  }
+
+  bool is_default() const {
+    return o_==NULL;
+  }
+  typedef bool (This::*unspecified_bool)() const;
+
+public:
+  Pointer(const Pointer &o): o_(NULL) {
+    set_pointer(o.o_);
+  }
+  Pointer& operator=(const Pointer &o){
+    set_pointer(o.o_);
+    return *this;
+  }
+  Pointer(): o_(NULL) {}
+  explicit Pointer(O* o): o_(NULL) {
+    IMP_assert(o, "Can't initialize with NULL pointer");
+    set_pointer(o);
+  }
+  ~Pointer(){
+    set_pointer(NULL);
+  }
+  const O& operator*() const {
+    audit();
+    return *o_;
+  }
+  O& operator*()  {
+    audit();
+    return *o_;
+  }
+  const O* operator->() const {
+    audit();
+    return o_;
+  }
+  O* operator->()  {
+    audit();
+    return o_;
+  }
+  O* get() const {
+    audit();
+    return o_;
+  }
+  void operator=(O* o) {
+    set_pointer(o);
+  }
+  IMP_COMPARISONS_1(o_);
+
+  bool operator!() const {
+    return !o_;
+  }
+
+  operator unspecified_bool() const {
+    return o_ ? &This::operator! : 0;
+  }
+};
+
+} // namespace IMP
+
+#endif  /* __IMP_OBJECT_POINTER_H */
Index: kernel/include/IMP/Optimizer.h
===================================================================
--- kernel/include/IMP/Optimizer.h	(revision 619)
+++ kernel/include/IMP/Optimizer.h	(working copy)
@@ -11,11 +11,11 @@
 #include "IMP_config.h"
 #include "base_types.h"
 #include "VersionInfo.h"
-#include "internal/Object.h"
+#include "Object.h"
 #include "utility.h"
 #include "Model.h"
 #include "Particle.h"
-#include "internal/ObjectPointer.h"
+#include "Pointer.h"
 
 #include <limits>
 
@@ -34,7 +34,7 @@
 /** \note There is currently no optimizer support for constraints
     (e.g. rigid bodies).
  */
-class IMPDLLEXPORT Optimizer: public internal::Object
+class IMPDLLEXPORT Optimizer: public Object
 {
 public:
   Optimizer();
@@ -198,7 +198,7 @@
   typedef std::vector<FloatIndex> FloatIndexes;
 
 private:
-  internal::ObjectPointer<Model, false> model_;
+  Pointer<Model> model_;
 };
 
 IMP_OUTPUT_OPERATOR(Optimizer);
Index: kernel/src/Object.cpp
===================================================================
--- kernel/src/Object.cpp	(revision 619)
+++ kernel/src/Object.cpp	(working copy)
@@ -6,15 +6,12 @@
  *
  */
 
-#include "IMP/internal/Object.h"
-#include "IMP/internal/RefCountedObject.h"
+#include "IMP/Object.h"
+#include "IMP/RefCountedObject.h"
 
 namespace IMP
 {
 
-namespace internal
-{
-
 unsigned int RefCountedObject::live_objects_=0;
 
 Object::Object()
@@ -35,6 +32,4 @@
              "Previously freed object is not valid: " << this);
 }
 
-} //namespace internal
-
 } // namespace IMP
Index: kernel/src/SConscript
===================================================================
--- kernel/src/SConscript	(revision 619)
+++ kernel/src/SConscript	(working copy)
@@ -20,7 +20,7 @@
 
 # Source files
 files = ['base_types.cpp', 'Model.cpp',
-         'Particle.cpp', 'ScoreState.cpp',
+         'Particle.cpp', 'ScoreState.cpp', 'Object.cpp',
          'OptimizerState.cpp', 'Log.cpp', 'Restraint.cpp', 'Optimizer.cpp',
          'random.cpp', 'Key.cpp', 'exception.cpp', 'ParticleRefiner.cpp'
         ] + decorators_files + restraints_files + optimizers_files \
Index: kernel/src/internal/Object.cpp
===================================================================
--- kernel/src/internal/Object.cpp	(revision 619)
+++ kernel/src/internal/Object.cpp	(working copy)
@@ -1,40 +0,0 @@
-/**
- *  \file Object.cpp
- *  \brief A shared base class to help in debugging and things.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
-#include "IMP/internal/Object.h"
-#include "IMP/internal/RefCountedObject.h"
-
-namespace IMP
-{
-
-namespace internal
-{
-
-unsigned int RefCountedObject::live_objects_=0;
-
-Object::Object()
-{
-  check_value_=111111111;
-  count_=0;
-}
-
-Object::~Object()
-{
-  assert_is_valid();
-  check_value_=666666666;
-}
-
-void Object::assert_is_valid() const
-{
-  IMP_assert(check_value_==111111111,
-             "Previously freed object is not valid: " << this);
-}
-
-} //namespace internal
-
-} // namespace IMP
Index: kernel/src/internal/SConscript
===================================================================
--- kernel/src/internal/SConscript	(revision 619)
+++ kernel/src/internal/SConscript	(working copy)
@@ -1,6 +1,6 @@
 Import('env')
 
-files = ['graph_base.cpp', 'ParticleGrid.cpp', 'Object.cpp',
+files = ['graph_base.cpp', 'ParticleGrid.cpp',
          'kernel_version_info.cpp', 'constants.cpp', 'bbox_nbl_helpers.cpp']
 
 files = [File(x) for x in files]
Index: kernel/pyext/IMP.i
===================================================================
--- kernel/pyext/IMP.i	(revision 619)
+++ kernel/pyext/IMP.i	(working copy)
@@ -162,8 +162,8 @@
 %feature("director") IMP::ParticleRefiner;
 
 %include "IMP/Key.h"
-%include "IMP/internal/Object.h"
-%include "IMP/internal/RefCountedObject.h"
+%include "IMP/Object.h"
+%include "IMP/RefCountedObject.h"
 %include "IMP/Index.h"
 %include "IMP/base_types.h"
 %include "IMP/VersionInfo.h"