more code, still needs tweaks on return json