Started refactoring. --wc