removing some dead code. Minor refactoring.