moving some view helper function