fixed variable visibility and docs