function IntToBin( Value: integer; Digits: integer ): string;
begin
result := StringOfChar ( '0', digits ) ;
while value > 0 do begin
if (value and 1) = 1 then
result[digits] := '1';
dec (digits) ;
value := value shr 1;
end;
end;

so i tried adding a defintion for the reset command but it doesn't seemed like it works
other method was moving the defintion around the localfunction which didn't work and ...