Some refactoring progress