Implement embedding

New UI can now embed, fixes for PIDs due to the switch to cjson from
json