this call to self.parent() can be moved to the 'else' block