Restructured client a bit and added more code contracts.