moved function to sake/core