converted to use json rather than the horribly unfinished unfinishedness