replacing uses of old test construct
refactor main method and fix shadowing
more if refactoring