Would be nice to re-use this in other places where this view is being called. Can do as a separate PR after this though.