Fix lack of proper variable declarations

*Added proper variable declarations throughout