Variable names and code layout

Fixed some variable names and beautified the code. Will it still run?