why use the algorithm environment hacked like `\renewcommand{\thealgorithm}{1}
\addtocounter{algorithm}{-1}
\floatname{algorithm}{Code}` ? just use the float package and define yourself a new float type \newfoloat{code} or whatever you want to call it