updated for variable scope and initialization testing