Refactor require code.