Refactoring and bug fix.