updated refactor