ex 2.21
added square function to helpers