Additional check to prevent script freeze
Minor fix
Code cleanup- 1
Code cleanup- 2
Patch : Code Freeze