some progress refactoring, but not fixing.