Updated square method

* Added unittest and docstrings
Updated docs.