refactoring program to have instance data, revisting styles a bit