updated function view algorithm