Seeking advice for function return