module.exports = function (creep) {

    if(creep.memory.currentTarget) {
        creep.memory.currentTarget = Game.getObjectById(creep.memory.currentTarget.id);
    }

    if(!creep.memory.currentTarget || (creep.memory.currentTarget.progress ? (creep.energy === 0) : (creep.energy === creep.energyCapacity || !creep.memory.currentTarget.energy) ) || (creep.memory.currentTarget.structureType === STRUCTURE_RAMPART && creep.memory.currentTarget.hits >= 1500) ) {
        if(!creep.memory.currentTarget || creep.energy === 0) {
            var target;
            var elements = [FIND_MY_SPAWNS, FIND_DROPPED_ENERGY, FIND_MY_STRUCTURES];

            elements.some(function(elementType) {
                creep.memory.currentTarget = creep.pos.findClosest(elementType, {
                    filter: function(element) {
                        return (element.energy && (element.name || (element.structureType ? element.structureType === STRUCTURE_LINK : true) ) )
                    },
                    algorithm: "astar"
                });
                return creep.memory.currentTarget;
            });

        } else {
            var target = Game.getObjectById(Memory.repairList[0]);
            if(!target) {
                target = creep.pos.findClosest(FIND_CONSTRUCTION_SITES);
            }
            if(!target) {
                target = creep.room.controller;
            }
            creep.memory.currentTarget = target;
        }
        if(!creep.memory.currentTarget) {
            creep.memory.currentTarget = Game.flags.Rally_Builders;
        }
    }
    if(creep.memory.currentTarget) {
        if(creep.pos.isNearTo(Game.getObjectById(creep.memory.currentTarget.id))) {
            if(creep.memory.currentTarget.progress !== undefined) {
                if(creep.memory.currentTarget.structureType === STRUCTURE_CONTROLLER) {
                    creep.upgradeController(Game.getObjectById(creep.memory.currentTarget.id));
                } else {
                    creep.build(Game.getObjectById(creep.memory.currentTarget.id));
                }
            } else {
                if(creep.memory.currentTarget instanceof Energy) {
                    creep.pickup(Game.getObjectById(creep.memory.currentTarget.id));
                } else if(creep.memory.currentTarget.structureType) {
                    creep.repair(Game.getObjectById(creep.memory.currentTarget.id));
                }
            }
        } else {
            var moveResult = creep.moveTo(Game.getObjectById(creep.memory.currentTarget.id), {reusePath: 10});
            if(moveResult === -2) {
                creep.memory.currentTarget = undefined;
                creep.memory._move = undefined;
            }
        }
    }
    

}



@@ -1142,24 +1142,117 @@
   var target
+;%0A%0A            for(var i = 0, i %3C Memory.repairList.length; i++) %7B%0A                var repair
  = Game.getO
@@ -1283,13 +1283,295 @@
 ist%5B
-0
+i
 %5D);%0A
+                if(repair.hits === repair.hitsMax) %7B%0A                    Memory.repairList.splice(i, 1);%0A                    i--;%0A                    continue;%0A                %7D else %7B%0A                    target = repair;%0A                    break;%0A                %7D%0A            %7D%0A%0A
     
@@ -1942,30 +1942,31 @@
 ;%0A        %7D%0A
-
     %7D%0A
+%0A
     if(creep
@@ -3115,14 +3115,6 @@
   %7D%0A
-    %0A%0A%7D%0A%0A
+%7D
 %0A

Make the builders remove the first in the repairList if it is maxed out