Moved some variables around, allowing easy pass through of information.