// refactorization and small goodies