internal algorithms improvements