API improvements, using shared_ptr internally for some sqlite handles.