Added Ref, cleaned up a few other things.