Minor refactoring
More refactorins
Removed dead code