changed to current working code without beautiful soup