More progress on refactoring