refactor to remove instance variable