Thank you for the quick response. I have added conditions to check for degenerate...
getParentElement hangs