refactoring for more generic coding use