Tests for client, minor additions and bugfixes