Fixed issues with variables being used before being initialized.