implemented unique_ptr to avoid boost.
implemented unique_ptr to avoid boost.