SI-6853 Changed internal method remove to a tail recursive version. Review by: @phaller