refactor to use class methods and class variables