Started fixing DBClient and tidying up code.