Separate function definition and export