Refactor some code

Simplified some statements
Changed some variable names