Move functions to internal package