Small syntax fixing

Variables were not declared as internal, but global.
Removed one unused variable.