refactor for streamlining