Some refactorings...