allow specifying url in url; default to self
split up monolithic graph() function