Extracted some of the views' code into helper methods