Simplified code for setContents