refactors fetch script