Refactor parser to generate URLs and be less messy.