Pergunta de entrevista da empresa Authenticx

Given existing, poorly written code, how can you improve it? Explain and implement your decisions.