Refactored some more variable names, simplified some code
Replaced all tab occurrences with spaces.