Update server.py

Updated some checks for square solutions that used index 9 rather than 0, updated function calls (to increase modularity), added some documentation to code