fix generation of ancestry with no parent
tidy up sendResponse
add test for ancestry