Changes to data types and minor refactoring

Changed the variables a bit.