implement return funapp optimization