refactoring, a lot of change and fix.