helpers: some refactorings