Square function