Refactoring and more fix.