refactor to use fetch