more core refactoring