clear_data method, plus some brief comments to document the api