Added checking for variable redeclaration