Refactoring

I removed some unused variables and cleaned the code.