Added actual result counting to the API test script as well as better inline documentation.