Bug fix
Code refactoring