rewrite to use json api

practically a full rewrite, still need to carve out the old info