Refactoring.
Bug fix