top functions refactorization