move some often copied code to fview.utils