fully converted to CS with scoping issues fixed