complete rewrite
switched from XML to JSON