refactoring code, removing dead code