Refactoring and singleton