extracted some functions to view_helpers