var contentItem = contentItems.pop(); simplifies this and the next line