Some refactoring