refactor JS (requests, selectors)