samll refactoring of init and set up