Changed local variable scope and removed redundant initialization.