Changed variables names heavily, refactored some code.