Refactors code, gets rid of unused instance variables