simplified visibility smoothing; some cleanup