refactor for instance variables, making things a bit more oo