Code refactor. Corrected variable declarations.