refactor to use openstruct class