refactor parser and fetcher into separate files and tests