Finished writing solution. Need to test on CS server.