updated with padding between nodes of diferent ancestors