public DistalDendriteSegment.Update getSegmentActiveSynapses(Cell currentCell, DistalDendriteSegment segment,
                                                               int time,
                                                               boolean newSynapses, DistalDendriteSegment predictedBy) {
    DistalDendriteSegment.Update result = new DistalDendriteSegment.Update(currentCell, segment, time, predictedBy);
    if (segment != null) {
      result.addAll(segment.getActiveCellSynapses(time));
    }
    int numberOfNewSynapsesToAdd = this.getNewSynapseCount() - result.getElementsList().size();
    if (newSynapses && numberOfNewSynapsesToAdd > 0) {
      List<Column> neighbors = currentCell.getNeighborsAndMyColumn();
      List<Cell> cellWithLearnStateList = new ArrayList<Cell>();
      //TODO Refac

      for (Column neighborColumn : neighbors) {
        List<Cell> cellList = neighborColumn.getElements();
        for (Cell cell : cellList) {
            /*NOTE: There is no indication in the Numenta pseudocode that a cell shouldn't be able to have a
            *distal synapse from another cell in the same column. Therefore the below check is commented out.
            * Skip cells in our own col (don't connect to ourself)
            * */
          //if (cell.belongsToColumn == this.belongsToColumn) {
          //  continue;
          // }
           /*But avoid self reverence*/
          if (cell == currentCell) {
            continue;
          }
          if (cell.getLearnState(time)) {
            cellWithLearnStateList.add(cell);
          }
        }
      }
      Collections.shuffle(cellWithLearnStateList);
      numberOfNewSynapsesToAdd = cellWithLearnStateList.size() < numberOfNewSynapsesToAdd ? cellWithLearnStateList.size() : numberOfNewSynapsesToAdd;
      for (int i = 0; i < numberOfNewSynapsesToAdd; i++) {
        Cell cellWithLearnState = cellWithLearnStateList.get(i);
        result.addElement(new Synapse.DistalSynapse(cellWithLearnState));
      }
    }
    currentCell.fireUpdatesChange();
    return result;
  }