factor out a part of the view