moved soem variable declarations around