Add some code for tracking parents