Optimized client library and added missing tests