Remove history in case of complex nesting

Make sure all recent history entries get removed even if they are not direct siblings to the 'Clear history' link