Bug fix.
Small refactoring.
Bug fix.