nice progress, more refactoring to come