Bug fix
Refactoring