wrote function2

@reviewer