Cleaned up the code a bit

Renamed the variables to something more readable, removed the dead code.
Happy with it now.