refactorings to make cleaner