function to create source for function