Add square, cube, and nth functions