added safe prunning