Client API improvement, test fixes, more tests