refactoring core_functions