Define a function in app