Improved performace

Replaced global variable to local variable
Merge pull request #4 from EvandroLG/patch-1

Improved performace