9 Bug fix, refactoring