Simplify code for setContents