Refactoring; removed unused code