Implemented deep option in preventSelections and restoreSelections