refeactored soft deletion code