refactoring createcore with tests