Successfully implemented square function

Haven't tested it with too much data, but I'll definitely get the
testing done before the deadline.