Move this block(line 57-60) to line 82 - declare variable as late as possible.