Refactoring code

Removed unused variables. Removed some of the fixed values. Small code
refactorization.